package cn.edu.nju.oraldefense.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import cn.edu.nju.oraldefense.dao.PaperDao;
import cn.edu.nju.oraldefense.model.Graduate;
import cn.edu.nju.oraldefense.model.Paper;
import cn.edu.nju.oraldefense.service.PaperService;

@Component("paperService")
public class PaperServiceImpl implements PaperService {
	private PaperDao paperDao;

	public PaperDao getPaperDao() {
		return paperDao;
	}

	@Resource
	public void setPaperDao(PaperDao paperDao) {
		this.paperDao = paperDao;
	}

	public Paper getById(int id) {
		return paperDao.findById(id);
	}

	public Paper getByGraduate(Graduate graduate) {
		return paperDao.findByGraduate(graduate);
	}

	public void addPaper(Paper paper) {
		paperDao.save(paper);
	}

	public void removePaper(Paper paper) {
		paperDao.delete(paper);
	}

	public void modifyPaper(Paper paper) {
		paperDao.update(paper);
	}

}
